package xiaohu.day0.HJ6;

import java.util.Scanner;

public class Main {
    //运行超时、通过率0.9
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int N = in.nextInt();
            StringBuilder sb = new StringBuilder();
            if (N > 1) {
                int index = 2;
                while (index <= N && N > 1) {
                    if (N % index == 0 && isPrime(index)) {
                        N = N / index;
                        sb.append(index+" ");
                        index=2;
                    } else {
                        index++;
                    }
                }
            }
            System.out.println(sb);
        }
    }

    //判断是否为质数
    private static boolean isPrime(int index) {
        int i=2;
        if (index > 2 && index % 2 == 0) {
            return false;
        }
        while (i <= index / 2) {
            if (index % i == 0) {
                return false;
            }
            i++;
        }
        return true;
    }
}

